#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# oniongitsharae: manage a global repo via decentral git instances
# you may peer with any number of other oniongitshare onions,
# and also nakedweb git servers.

# Think onionshare, but with permanent onion addresses, P2P and DVCS

# Python2/3. Dependencies:
#   - stem (torsocks pip install stem / via distro)
#     a recent version (>= 1.5.0) is needed for auth
#   - git must be installed
#   - torsocks must be installed
#   - tor must be up and running and the ControlPort open

# Use scenario:
# a) Run Tor.
# b) Run the server in the background and schedule a job for pulling from peers.
#    it is a git server that listens on <your-identifier>.onion:9418
#    it's to be expected that peers uptime will intersect with yours
#    only a fraction of the time. That is not a problem.
# c) oniongitshare creates a git, which you may use to push and pull your own changes.

# Bugs:
# FIXME: clean up hidservauth entries on stop

# Ideas:
# - General overhaul. Repositories should be mirrored. Must get the whole graph, including all branches etc.
# - Also manage issue tracker in git. In separate repository?
# - Also support other DVCSes
# - Manage user identities in web of trust (use system GPG and git's commit signing mechanism
#   and update the documentation, putting an emphasis on the importance of only using versions
#   that were signed off by the maintainer or someone you trust)
# - Better management of swarm metadata, maybe also in a separate repo


import oniongitshare
import sys

if __name__=='__main__':
    try:
        oniongitshare.main(args=sys.argv[1:])
    except KeyboardInterrupt as e:
        print("Ctrl-C caught, quitting.")
